<?php
/**
 * Created by PhpStorm.
 * User: h
 * Date: 2021/4/28
 * Time: 19:22
 */

namespace app\api\controller\v1;


use app\Request;
use think\facade\Session;

class Login extends BaseController
{
    public function createcode()
    {
        $code = setcode();
        return sucessMsg(200, '获取成功', $code);
    }

    public function reg()
    {
        dd(\session());
        $code = input('code');
        $code_status = getcode($code);

        if ($code_status == 401) {
            return errMsg(400, '验证码失效');
        } elseif ($code_status == 402) {
            return errMsg(400, '验证码错误');
        } else {
            session($code_status, null);
        }
        return 111;
    }
}